using System;
using System.Data;

namespace TimeSheetBLL.Brokers
{
	/// <summary>
	/// Summary description for ClientBroker.
	/// </summary>
	public class ClientBroker : Broker
	{
		public ClientBroker() : base()
		{
			
		}

		public override DataTable SelectAll( IDBEntity entity )
		{
			string statement = "SELECT * FROM client WHERE active = 1 ORDER BY client_name";
			return this.data.GetTable( statement );
		}

		public override bool Delete( IDBEntity entity )
		{
			Client client = (Client)entity;
			client.Active = false;
			return data.ExecuteNonQuery( tools.DBUpdateQuery( client ) ) > 0;
		}
	}
}
